<template>
  <van-swipe
    class="banner-box"
    :autoplay="3000"
    lazy-render
    indicator-color="white"
  >
    <router-link
      :to="{ name: 'Detail', query: { id: item.id } }"
      v-for="item in banner"
      :key="item.id"
    >
      <van-swipe-item class="item-box">
        <img :src="item.image" />
        <div class="banner-title">
          <p class="title txtHide">{{ item.title }}</p>
          <p class="hint txtHide">{{ item.hint }}</p>
        </div>
      </van-swipe-item>
    </router-link>
  </van-swipe>
</template>

<script>
export default {
  props: {
    banner: {
      type: Array,
      default: [],
    },
  },
};
</script>

<style lang="scss" scoped>
/deep/.van-swipe__indicators {
  left: auto;
  right: 0;
}
/deep/.van-swipe__indicator--active {
  width: 0.2rem;
  border-radius: 0.05rem;
}
.banner-box {
  width: 100%;
  .item-box {
    position: relative;
    img {
      width: 100%;
      display: block;
    }
    .banner-title {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      padding: 0.15rem;
      background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.9));
      .title {
        font-size: 0.18rem;
        color: #fff;
      }
      .hint {
        margin-top: 0.1rem;
        font-size: 0.12rem;
        color: #fff;
      }
    }
  }
}
</style>